package com.demos.springcloud.provider05Get.controller;

import com.common.tools.RequestTools;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("get")
public class controller {

    @GetMapping("data/{id}")
    public Map<String, Object> service1(@PathVariable String id, HttpServletRequest request){
        System.out.println(LocalDateTime.now() + " g2 : " + id);

        Map<String, Object> map = new HashMap<>();
        map.put("id", id);
        map.put("name", "provider05Get");
        map.put("header", RequestTools.getHeaders(request));
        map.put("parameter", RequestTools.getRequestParam(request));
        map.put("Thread", Thread.currentThread().getName());
        return map;
    }
}
